<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .zong {
            width: 600px;
            margin: auto;
            position: relative;
        }

        .title {
            box-sizing: border-box;
            width: 100%;
            height: 100px;
            padding: 20px;
            background: url("https://c.53326.com/d/file/newpc202302/smqbcapjbp0.jpg") no-repeat center/cover;

        }

        .title>h1 {
            width: 100%;
            height: 100%;
            line-height: 50px;
            margin: 0;
            text-align: center;
            color: white;
        }

        .navigation {
            width: 100%;
            height: 100px;
            position: relative;
            box-sizing: border-box;
            padding: 20px;
        }

        .navigation>input {
            box-sizing: border-box;
            width: 100%;
            height: 60px;
            border-radius: 10px;
            padding-left: 20px;
            font-size: 20px;
        }

        .navigation>input::placeholder {
            font-size: 20px;
            line-height: 60px;
        }

        .navigation>button {
            width: 100px;
            height: 60px;
            position: absolute;
            right: 14px;
            top: 20px;
            border-radius: 0 10px 10px 0;
        }

        .content {
            width: 100%;
            box-sizing: border-box;
            padding: 20px;
        }

        .content_title {
            width: 100%;
            height: 50px;
            background-color: aqua;
            border-radius: 10px 10px 0 0;
            border: 2px solid;
            position: relative;
        }

        .content_title>h5 {
            box-sizing: border-box;
            width: 70%;
            padding: 0 10px;
            font-size: 16px;
            margin: 0;
            line-height: 50px;
            vertical-align: middle;
            display: inline-block;
            border-radius: 0 8px 0 0;
            border: 2px solid;
            position: absolute;
            right: 0;
            top: 0;
        }

        .content_title>div {
            box-sizing: border-box;
            display: inline-block;
            vertical-align: middle;
            width: 30%;
            height: 100%;
            line-height: 50px;
            font-size: 16px;
            font-weight: 600;
            text-align: center;
            border-left: 2px solid;
            border-top: 2px solid;
            border-radius: 8px 0 0 0;
            cursor: pointer;
        }

        .content_nav {
            width: 100%;
            border: 2px solid;
            border-radius: 0 0 10px 10px;
            background-color: azure;
        }

        .content_nav>ul {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            padding: 20px 30px;
        }

        .content_nav>ul>li {
            list-style: none;
            width: 100%;
            height: 55px;
            position: relative;
            background-color: antiquewhite;
            margin-bottom: 10px;
            border-radius: 10px;
            border: 3px solid;
        }

        .content_nav li>input {
            font-size: 20px;
            position: absolute;
            left: 10px;
            top: 20px;
        }


        .content_nav li>p {
            position: absolute;
            left: 40px;
        }

        .content_nav li>button {
            position: absolute;
            right: 20px;
            top: 20px;
        }

        .ce {
            width: 150px;
            position: absolute;
            right: -200px;
            top: 230px;
            background-color: beige;
            border-radius: 10px;
            border: 2px solid;
        }

        .ce>ul {
            width: 100%;
            height: 100%;
            padding: 10px;
            margin: 0;
            box-sizing: border-box;
            text-align: center;
        }

        .ce>ul>li {
            width: 100%;
            height: 50px;
            line-height: 50px;
            border: 1px solid;
            margin-bottom: 5px;
            list-style: none;
            border-radius: 10px;
        }
    </style>
</head>

<body>
    <div class="zong">
        <div class="title">
            <h1>事件簿</h1>
        </div>
        <div class="navigation">
            <input type="text" placeholder="新增代办事项...">
            <button onclick="sit()">提交</button>
        </div>
        <div class="content">
            <div class="content_title">
                <div onclick="done()">全部标记为已完成</div>
                <h5>今日事今日毕，勿将今事待明日!☕</h5>
            </div>
            <div class="content_nav">
                <ul>
                    <li>
                        <input type="checkbox" class="choose">
                        <p>111111111</p>
                        <button class="shan">×</button>
                    </li>
                </ul>
            </div>
        </div>
        <div class="ce">
            <ul>
                <li><span onclick="kai()">开</span></li>
                <li><span onclick="ce_done()">已完成</span></li>
                <li><span onclick="ce_coned()">未完成</span></li>
                <li><span onclick="ce_quan()">全部</span></li>
                <li><span onclick="ce_clear()">清除所有事项</span></li>
            </ul>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.7.1.js"></script>
    <SCript>
        //数据
        var arr = []
        var arr_1 = []
        var arr_2 = []
        // 渲染
        function xuan() {
            $('.content_nav ul').html('')
            arr.forEach(item => {
                $('.content_nav ul').append(`
                <li>
                    <input type="checkbox" class="choose">
                    <p>${item.text}</p>
                    <button class="shan" onclick="shan(${item.id})">×</button>
                </li>`)
            })
            //事件为空
            if (arr == '') {
                $('.content_nav ul').html(`
                    <div style="width: 100%;height: 300px;">
                        <p>添加你的第一个待办事项！📝</p>
                        <p>食用方法💡：</p>
                        <p>✔️ 双击上面的标语和 Todo 可进行编辑</p>
                        <p>✔️ 所有提交作支持Enter回车键提交</p>
                        <p>✔️ 拖拽Todo上下移动可排序（仅支持PC）</p>
                        <p>✔️ 右侧的小窗口是快捷操作哦</p>
                        <p>🔒 所有的Todo数据存储在浏览器本地</p>
                        <p>📝 支持下载和导入，导入追加到当前序列</p>
                    </div>
                `)
            }
        } xuan()
        //添加
        function sit() {
            var a = $('.navigation input').val()
            arr.push({
                id: arr.length,
                text: a,
            })
            var a = $('.navigation input').val('')
            xuan()
        }
        //全部完成
        function done() {
            var inps = $(".content_nav input")
            inps.each((index, item) => {
                item.checked = true
            })
        }
        //删除
        function shan(id) {
            var a = arr.findIndex(item => item.id == id)
            arr.splice(a, 1)
            xuan()
        }
        //开关
        function kai() {
            $('.ce').html(`
            <ul>
                <li onclick="clo()">关</li>
                <li>快捷操作</li>
            </ul>
            `)
        }
        //开
        function clo() {
            $('.ce').html(`
                <ul>
                    <li><span onclick="kai()">开</span></li>
                    <li>已完成</li>
                    <li>未完成</li>
                    <li>清除所有事项</li>
                </ul>
            `)
        }
        //已完成
        function ce_done() {
            var inps = $(".content_nav input")
            inps.each((index, item) => {
                if (item.checked) {
                    var a = arr.find(item => item.id == index)
                    arr_1.push({
                        id: a.id,
                        text: a.text
                    })
                } else {
                    var a = arr.find(item => item.id == index)
                    arr_2.push({
                        id: a.id,
                        text: a.text
                    })
                }
            })
            $('.content_nav ul').html('')
            arr_1.forEach(item1 => {
                $('.content_nav ul').append(`
                    <li>
                        <input type="checkbox" class="choose">
                        <p>${item1.text}</p>
                        <button class="shan" onclick="shan(${item1.id})">×</button>
                    </li>`)
            })

        }
        //未完成
        function ce_coned() {
            var inps = $(".content_nav input")
            inps.each((index, item) => {
                if (!item.checked) {
                    var a = arr.find(item => item.id == index)
                    arr_2.push({
                        id: a.id,
                        text: a.text
                    })
                } else {
                    var a = arr.find(item => item.id == index)
                    arr_1.push({
                        id: a.id,
                        text: a.text
                    })
                }
            })
            $('.content_nav ul').html('')
            arr_2.forEach(item2 => {
                $('.content_nav ul').append(`
                    <li>
                        <input type="checkbox" class="choose">
                        <p>${item2.text}</p>
                        <button class="shan" onclick="shan(${item2.id})">×</button>
                    </li>`)
            })
            console.log($('.choose').prop('checked'));

        }
        //全部事件
        function ce_quan() {
            xuan()
        }
        //清空
        function ce_clear() {
            arr = []
            arr_1 = []
            arr_2 = []
            xuan()
        }
    </SCript>
</body>

</html>